//
//  WeeklyLetterBean.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/2/22.
//

import Foundation
//邀请奖励
class InviteRewardBean : ICloudTable, Identifiable {
    func getCloudTable() -> String {
        return "InviteReward"
    }
    
    //leanCloud 排除字段
    func doCustomExcluded() -> [String? : Any?] {
        return doExcluded(subject: self, excluded: [])
    }
    
    var objectId: String? = nil
    var rewardUserId: String? = nil//奖励者
    var userId: String? = nil
    var avatar: String? = nil
    var name: String? = nil
    var content: String? = nil
    var count: Float? = nil//奖励的回应次数
    var qq: String? = nil//qq
    var wx: String? = nil//wx
    var phone: String? = nil//wx
    var apple: String? = nil//apple
    var reward: Bool? = nil//是否领取
    var test: Bool? = nil
    
    func getCountStr()-> String {
        return formatPrice(Double(count ?? 0.0))
    }
    
    func showName() -> String {
        let name = name ?? ""
        guard !name.isEmpty else {
            return ""
        }
        if name.count == 1 {
            return name
        }
        let lastChar = name.last! // 非空字符串一定有 last
        let stars = String(repeating: "*", count: name.count - 1)
        return stars + String(lastChar)
    }
}
